package com.ys.everydaynews.ui.main.fragment

import android.content.Intent
import android.util.Log
import android.view.View
import com.ys.everydaynews.R
import com.ys.everydaynews.base.BaseFragment
import com.ys.everydaynews.databinding.FragmentHomeBinding
import com.ys.everydaynews.databinding.FragmentMineBinding
import com.ys.everydaynews.mvp.presenter.BasePresenter
import com.ys.everydaynews.mvp.view.BaseView
import com.ys.everydaynews.ui.main.activityy.LoginNoPassActivity
import com.ys.everydaynews.ui.main.activityy.RegisterAtivity
import com.ys.everydaynews.ui.main.activityy.UserInfoUpdataActivity

class MineFrament : BaseFragment<BaseView, BasePresenter<BaseView>, FragmentMineBinding>(){


    override fun initView() {
        binding.loginBtn.setOnClickListener {
            startActivity(Intent().setClass(activity!!,LoginNoPassActivity::class.java))
        }
        binding.imHead.setOnClickListener { starActivity(UserInfoUpdataActivity::class.java) }
    }

    override fun initData() {
        Log.e("Token",isTokenNotNull().toString())
        if(!isTokenNotNull()){
            binding.rlLogin.visibility=View.VISIBLE
            binding.loginBtn.visibility=View.GONE
        }else{
            binding.rlLogin.visibility=View.GONE
            binding.loginBtn.visibility=View.VISIBLE
        }
    }

    override fun getLayoutId(): Int =R.layout.fragment_mine

    override fun createPersenter()=BasePresenter<BaseView>()
    override fun <T> setData(data: T) {
    }

    override fun setError(err: String) {
    }

    override fun isRegister(): Boolean =false
}